//
//  MKUIPopoverMenu.h
//  MKUI
//  提供两种展示弹出框选项菜单的集合视图
//  Created by 苏尚进 on 2024/11/25.
//  Copyright © 2024 moon. All rights reserved.
//

#import "MKUIPopoverView.h"
#import "MKUICollectionView.h"
#import "MKUICollectionViewCellBase.h"
#import "MKUIFlowLayoutButton.h"
#import "MKUIListView.h"

NS_ASSUME_NONNULL_BEGIN
//弹出框菜单选项
@interface MKUIPopoverMenu : NSObject
@property(nonatomic,strong,nullable) NSString *title;//按钮标题
@property(nonatomic,strong,nullable) UIImage *image;//按钮图标
@property(nonatomic,strong,nullable) UIImage *darkImage;//按钮图标(黑暗模式）
@property(nonatomic,assign) BOOL shouldDismissWhenClick;//点击时，是否取消弹窗，默认为YES
@property(nonatomic,copy,nullable) void(^whenClick)(MKUIPopoverMenu *menu);//点击事件
+ (instancetype)menuWithTitle:(nullable NSString *)title image:(nullable UIImage *)image darkImage:(nullable UIImage *)darkImage whenClick:(void(^ _Nullable)(MKUIPopoverMenu *menu))whenClick;
+ (instancetype)menuWithTitle:(nullable NSString *)title whenClick:(void(^ _Nullable)(MKUIPopoverMenu *menu))whenClick;
@end
NS_ASSUME_NONNULL_END

///使用UICollectionView展示多行菜单选项
NS_ASSUME_NONNULL_BEGIN
//pop弹出框菜单collection cell视图
@interface MKUIPopoverMenuItemCollectionViewCell : MKUICollectionViewCellBase
@property(nonatomic,readonly) MKUIFlowLayoutButton *menuButton;
@property(nonatomic,readonly,nullable) MKUIPopoverMenu *popoverMenu;
@end
//pop弹出框菜单选项，使用UICollectionView集合视图，允许多行显示
@interface MKUIPopoverMenuCollectionView : MKUIPopoverView
@property(nonatomic,readonly) MKUICollectionView *collectionView;
@property(nonatomic,readonly) UICollectionViewFlowLayout *flowCollectionViewLayout;
@property(nonatomic,assign,nullable) Class cellClass;//自定义的按钮展示类，比如MKUIPopoverMenuItemCollectionViewCell.class
@property(nonatomic,strong) NSArray<MKUIPopoverMenu *> *popoverMenus;//当前所有的按钮数组
/// 添加按钮
/// - Parameter menu;: 按钮对象
- (void)addMenu:(nullable MKUIPopoverMenu *)menu;
- (void)reloadMenus;//刷新集合视图
- (Class)menuCellClassForMenu:(MKUIPopoverMenu *)menu;//返回菜单cell视图类，默认为self.cellClass
@end
NS_ASSUME_NONNULL_END

///使用MKUIListView展示菜单选项，左右/上下滚动
NS_ASSUME_NONNULL_BEGIN
//pop弹出框菜单list cell视图
@interface MKUIPopoverMenuListViewCell : MKUIListSelectionCellViewBase
@property(nonatomic,readonly) MKUIFlowLayoutButton *menuButton;
@property(nonatomic,assign) MKUIListViewScrollDirection scrollDirection;//滚动方向，默认为左右滚动
@property(nonatomic,strong,nullable) MKUIPopoverMenu *popoverMenu;
- (void)reloadMenu;//刷新数据
@end
//pop弹出框菜单选项，横向展示MKUIListView集合视图，一行显示，左右滚动
@interface MKUIPopoverMenuListView : MKUIPopoverView
@property(nonatomic,readonly) MKUIListView *listView;
@property(nonatomic,assign) MKUIListViewScrollDirection scrollDirection;//滚动方向，默认为左右滚动MKUIListViewScrollDirectionHorizontal
@property(nonatomic,assign,nullable) Class cellClass;//自定义的按钮展示类，比如MKUIPopoverMenuListViewCell.class
@property(nonatomic,strong) NSArray<MKUIPopoverMenu *> *popoverMenus;//当前所有的按钮数组
- (void)customMenuCell:(__kindof MKUIPopoverMenuListViewCell *)cell;//用于定制化cell属性
/// 添加按钮
/// - Parameter menu;: 按钮对象
- (void)addMenu:(nullable MKUIPopoverMenu *)menu;
- (void)reloadMenus;//刷新list视图
- (Class)menuCellClassForMenu:(MKUIPopoverMenu *)menu;//返回菜单cell视图类，默认为self.cellClass
@end
NS_ASSUME_NONNULL_END
